import Mock from 'mockjs'
import { builder } from './util.js'

const Random = Mock.Random

const goodList = () => {
	let data = []
	
	for(let i = 0; i < 15; i++) {
		data.push({
			id: Random.integer(1,999),
			image: Random.image('750x750'),
			title: Mock.mock('@cname'),
			originalPrice: Random.integer(9999,88888),
			favourPrice: Random.integer(1111,9999)
		})
	}
	return builder(data, '', 1)
}

const goodDetail = () => {
	return builder({
		image: Random.image('750x750'),
		title: Mock.mock('@cname'),
		originalPrice: Random.integer(9999,88888),
		favourPrice: Random.integer(1111,9999),
		content: "<p>内容标签</p>"
	}, '', 1)
}

Mock.mock('http://localhost/api/good/list','get',goodList)
Mock.mock('http://localhost/api/good/detail','get',goodDetail)